package com.qf.fmall2203.vo;

import java.util.HashMap;
import java.util.Map;

public class ResultVo extends HashMap<String, Object> {
    public static ResultVo ok(){
        final ResultVo resultVo = new ResultVo();
        resultVo.put("code",10000);
        resultVo.put("msg","success");
        return resultVo;
    }

    public static ResultVo ok(Object data){
        final ResultVo resultVo = new ResultVo();
        resultVo.put("code",10000);
        resultVo.put("msg","success");
        resultVo.put("data",data);
        return resultVo;
    }

    public static ResultVo error(){
        final ResultVo resultVo = new ResultVo();
        resultVo.put("code",-1);
        resultVo.put("msg","error");
        return resultVo;
    }

    public static ResultVo error(String msg){
        final ResultVo resultVo = new ResultVo();
        resultVo.put("code",-1);
        resultVo.put("msg",msg);
        return resultVo;
    }


    public static ResultVo error(Integer code ,String msg){
        final ResultVo resultVo = new ResultVo();
        resultVo.put("code",code);
        resultVo.put("msg",msg);
        return resultVo;
    }
}
